<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        /*var str2="abcd";
        var reg=/\w*?\d?/gi;
        // var arr=str2.match(reg)
        var arr=reg.exec(str2);
        console.log(arr);*/

        /**
         * 贪婪匹配与懒惰匹配  限定符后加？变懒惰
         * @type {string}
         */
        /*var str3="helloworld";
        var reg3_1=/h.*l/;
        var reg3_2=/h.*?l/;
        var arr2=str3.match(reg3_1);
        console.log(arr2);
        var arr3=str3.match(reg3_2);
        console.log(arr3);

        var str4="hello0hello12hello";
        var reg4=/\d*!/
        var arr4=str4.replace(reg4,"pp");
        console.log(arr4)*/

        /**
         * 捕获与非捕获
         * @type {string}
         */
        /*var str="Regular Capture";
        var reg=/(\w+)\s(\w+)/g;
        console.log(str.match(reg));
        console.log(str.replace(reg,"$2 $1"));*/
        /**
         * 方向引用
         * @type {string}
         */
       /*var str="113335 12345 56668";
        var reg=/(\d)\1(\d)\2/gi;
        console.log(str.match(reg));*/

        /**
         * 零宽断言
         * @type {string}
         */
        var htmlStr="<div id='fg1'><img src='../homework/homework12_24/dm1.jpg'></div><div>123456</div><div id='fg1'><img src='../homework/homework12_24/dm1.jpg'></div>";
        var regx=/<div[^>]*>(?!<img).*?<\/div>/g;
        console.log(htmlStr.match(regx))

    </script>
</head>
<body>

</body>
</html>